package com.lu.util;


import org.springframework.util.StringUtils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @author issuser
 * @ClassName CreateIdUtil
 * @Description
 * @date 2021/07/12 19:20
 */
public class CreateIdUtil {

    private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    private static final Random RANDOM = new Random();
    private static final int RANDOM_NUM = 1000000;

    public static String createId(String preStr) {
        if (preStr == null) {
            preStr = "";
        }
        return preStr + SDF.format(new Date()) + (RANDOM.nextInt(RANDOM_NUM) + RANDOM_NUM);
    }
}
